package july.framework.exsolver.executor;

import july.framework.exsolver.bean.Resolver;
import july.framework.exsolver.reader.ExcelReader;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ResolveExcutor {
    private Resolver resolver;

    public ResolveExcutor(Resolver resolver){
        this.resolver = resolver;
    }

    public <T> List<T> execute(Class<T> returnType, String fileName)
            throws IllegalAccessException, InstantiationException, IOException {

        List<T> res = new ArrayList<>();

        // 读取excel文件,解析内容
        ExcelReader reader = new ExcelReader(fileName);

        res = this.resolver.getAnalizedData(returnType,reader.getSheetMap());

        return res;
    }
}
